cmake_minimum_required(VERSION 3.2)

project(multidir)

if(${CMAKE_BUILD_TYPE} MATCHES "Release")
    message(STATUS "Release")
    set(BuildType "Release")
else()
    message(STATUS "Debug")
    set(BuildType "Debug")
endif()

set(RELEASE_DIR ${PROJECT_SOURCE_DIR}/release)

set(LIBRARY_OUTPUT_PATH ${RELEASE_DIR}/linux/${BuildType})
set(EXECUTABLE_OUTPUT_PATH ${RELEASE_DIR}/linux/${BuildType})
add_compile_options(-fPIC)

aux_source_directory(. DIR_SRCS)

include_directories("${PROJECT_SOURCE_DIR}/dir1")
add_subdirectory(dir1)

include_directories("${PROJECT_SOURCE_DIR}/dir2")
add_subdirectory(dir2)

add_executable(multidir main.c)
target_link_libraries(multidir dir1 dir2)